var app = getApp();
Page({
  data: {
    section: [{
      name: '优惠券',
      typeId: '1'
    }, {
      name: '代金券',
      typeId: '2'
    }
    ],
    list: [{
      shangjia: '已上架',
      full_price: 500,
      minus_price: 300,
    },
    {
      shangjia: '已上架',
      full_price: 500,
      minus_price: 300,
    }
    ],
   
    lists: [{
      shangjia:'已上架',
      full_price: 90,
      minus_price: 100,
    },
    {
      shangjia: '未上架',
      full_price: 90,
      minus_price: 100,
    }
    ],
    section: [{
      name: '优惠券',
      typeId: '1'
    }, {
      name: '代金券',
      typeId: '2'
    }
    ],
    currentId: '1',
  },

  /**
   * 生命周期函数--监听页面加载
   */
  handleTap: function (e) {
    var id = e.currentTarget.id;
    this.setData({
      currentId: id,
      zd_price: ''
    })
  },

  onShow: function () {
    this.getYouDaiList();
  },

  getYouDaiList:function(){
    var t = this;
    app.visit("huodong/getYouDaiList", {
      store_id:wx.getStorageSync("store_id"),
    }, "", function(c) {
      console.log(c)
      if(0 == c.code){
        t.setData({
          list:c.data.coupon,
          lists:c.data.vouchers
        })
      }else{
        app.showToast(c.msg)
      }
    })
  },

  yhq_edit: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: 'yhq_edit?id='+id
    });
  },
  djq_edit: function (e) {
    var id = e.currentTarget.dataset.id;
    wx.navigateTo({
      url: 'djq_edit?id='+id
    });
  },
  yhq_add: function (e) {
    wx.navigateTo({
      url: 'yhq_add'
    });
  },
})